package com.faxsun.core.tool;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class MobilePhoneMask {

	public static String maskMobilePhone(String mobilePhone){
		Pattern p = Pattern
				.compile("^((13[0-9])|(15[^4,\\D])|(18[0-9]))\\d{8}$");

		Matcher m = p.matcher(mobilePhone);
		StringBuffer sb=new StringBuffer(mobilePhone);
		if(m.matches()){
			//手机号仅显示部分
			int index=m.start();
			sb.replace(index+3, index+7, "****");
			
		}
		return sb.toString();
	}
}
